//
//  UseTabView.swift
//  learn-ios
//
//  Created by Dong on 2022/4/6.
//

import SwiftUI

struct UseTabView: View {
    @State private var selection: TabUse = .User
    enum TabUse {
        case User
        case Group
        case Enterprise
    }

    var body: some View {
        TabView(selection: $selection) {
            Text("User")
                .tabItem{
                    Label("用户",systemImage: "person")
                }
                .tag(TabUse.User)

            Text("Group")
                .tabItem{
                    Label("组",systemImage: "person.3")
                }
                .tag(TabUse.Group)
            
            Text("Enterprise")
                .tabItem{
                    Label("企业",systemImage: "bag")
                }
                .tag(TabUse.Enterprise)
        }
        // 设置样式(.page: 翻页)
        .tabViewStyle(.page)
    }
}

struct UseTabView_Previews: PreviewProvider {
    static var previews: some View {
        UseTabView()
    }
}
